/**
 * File: BytearrayOutputStreamProvider.java
 * Created by: mhaimel
 * Created on: Aug 1, 2011
 * CVS:  $Id: BytearrayOutputStreamProvider.java 1.0 Aug 1, 2011 4:54:58 PM mhaimel Exp $
 */
package uk.ac.ebi.curtain.storage.sequence;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;


/**
 * @author mhaimel
 *
 */
public class BytearrayOutputStreamProvider implements StreamProvider<OutputStream> {
	
	private final ByteArrayOutputStream out;

	public BytearrayOutputStreamProvider() {
		this(new ByteArrayOutputStream());
	}
	
	public BytearrayOutputStreamProvider(ByteArrayOutputStream out) {
		this.out= out;
	}

	@Override
	public OutputStream openAndGetStream() throws IOException {
		return this.out;
	}

	@Override
	public String getName() {
		return this.out.getClass().toString();
	}
	
	public ByteArrayOutputStream getOutput() {
		return out;
	}
}
